<template>
    <div>
        <h2>公告首页</h2>
        <h3>eventBus</h3>
        <button @click="go">点击发送数据</button>
        <Parent></Parent>
    </div>
</template>
<script>
import Parent from '../components/Parent.vue'
import Event from '../utils/eventBus'
export default{
    components:{
        Parent
    },
    data(){
        return {
            msg:'我是公告首页的数据'
        }
    },
    methods:{
        go(){
            //Event.$emit('aaa',this.msg);
        }
    },
    created(){
        Event.$emit('aaa',this.msg);

        
    },
    mounted(){
        Event.$on('bbb',(v)=>{
            console.log(v);
        })
    },
    beforeDestroy(){
        Event.$off();
    }
}
</script>